package com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.controller;

import com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.entity.bo.SensitiveWordParam;
import com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.entity.vo.SensitiveResult;
import com.gitee.jjnnzb.designpatterninspring.business.sensitive_word.service.SensitiveWordService;
import com.gitee.jjnnzb.designpatterninspring.common.bean.ResponseBean;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jjn
 * @since 2023/8/11 11:38
 */
@RestController
@Tag(name = "敏感词过滤")
@RequiredArgsConstructor
public class SensitiveWordController {
    
    private final SensitiveWordService sensitiveWordService;
    
    @PostMapping(value = "/api/v1/sensitive-word/filter")
    @Operation(operationId = "敏感词过滤接口", description = "责任链模式Demo")
    public ResponseBean<SensitiveResult> filter(@RequestBody SensitiveWordParam sensitiveWordParam) {
        SensitiveResult result = sensitiveWordService.handleSensitiveWord(sensitiveWordParam);
        return ResponseBean.success(result);
    }
}
